package com.topisv.tms.entity;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.fasterxml.jackson.annotation.JsonIgnore;

//库区
@Entity
@Table(name = "pms_storage")
public class Storage extends IdEntity implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	//包装辅料仓；成品备用仓；货物暂存仓；问题件暂存仓
	private String name;
	
	//简易库区 simple 复杂库区 complex
	private String type;
	
	private Long areagroupId;
	
	//库区编码-分仓编码+客户编码
	private String code;
	
	//简易库区的库位数
	private int num;
	
	private AreaGroup areaGroup;
	
	public int getNum() {
		return num;
	}

	public void setNum(int num) {
		this.num = num;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Storage(){
	}
	
	public Storage(Long id){
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Transient
	@JsonIgnore
	public Long getAreagroupId() {
		return areagroupId;
	}

	public void setAreagroupId(Long areagroupId) {
		this.areagroupId = areagroupId;
	}

	@ManyToOne
	@JoinColumn(name = "areagroup_id")
	public AreaGroup getAreaGroup() {
		return areaGroup;
	}

	public void setAreaGroup(AreaGroup areaGroup) {
		this.areaGroup = areaGroup;
	}
	
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
